//
//  PerformanceItemVM.swift
//  kxf
//
//  Created by Mac on 2024/3/24.
//

import Foundation
import UIKit

class PerformanceItemVM: UIView {
    
    let selfHeight = kFitWidth(80)

    override init(frame:CGRect){
        super.init(frame: CGRect.init(x: frame.origin.x, y: frame.origin.y, width: kFitWidth(166), height: selfHeight))
        self.backgroundColor = WHColor_RGB(r: 255.0, g: 246.0, b: 235.0) // 255 246 235
        self.isUserInteractionEnabled = true
        self.layer.cornerRadius = kFitWidth(12)
        self.clipsToBounds = true
        
        initUI()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    lazy var titleLabel : UILabel = {
        let lab = UILabel()
        lab.textColor = .COLOR_TEXT_BLACK666
        lab.font = .systemFont(ofSize: 14, weight: .regular)
        
        return lab
    }()
    lazy var numLabel : UILabel = {
        let lab = UILabel()
        lab.textColor = WHColor_16(colorStr: "FF7E00")
        lab.font = .systemFont(ofSize: 18, weight: .medium)
        lab.adjustsFontSizeToFitWidth = true
        
        return lab
    }()
    lazy var imgView : UIImageView = {
        let img = UIImageView()
        img.setImgLocal(imgName: "perfomance_item_img")
        
        return img
    }()
}

extension PerformanceItemVM{
    func initUI() {
        addSubview(titleLabel)
        addSubview(numLabel)
        addSubview(imgView)
        
        setConstrait()
    }
    func setConstrait() {
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(12))
            make.top.equalTo(kFitWidth(17))
        }
        numLabel.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(12))
            make.top.equalTo(kFitWidth(39))
            make.right.equalTo(kFitWidth(-10))
        }
        imgView.snp.makeConstraints { make in
            make.right.bottom.equalToSuperview()
            make.width.equalTo(kFitWidth(69))
            make.height.equalTo(kFitWidth(63))
        }
    }
}
